import request from "@/utils/request";

// 查询客户信息列表
export function listInfo(query) {
  return request({
    url: "/custom/info/list",
    method: "get",
    params: query,
  });
}

export function listOfContractType(query) {
  return request({
    url: "/custom/info/listOfContractType",
    method: "get",
    params: query,
  });
}

export function listContract(query) {
  return request({
    url: "/custom/info/listContract",
    method: "get",
    params: query,
  });
}

export function listTask(query) {
  return request({
    url: "/custom/info/listTask/" + query,
    method: "get",
  });
}

export function listForFinance(query) {
  return request({
    url: "/custom/info/listForFinance",
    method: "get",
    params: query,
  });
}

// 查询客户信息详细
export function getInfo(id) {
  return request({
    url: "/custom/info/" + id,
    method: "get",
  });
}

export function applyBecome(id) {
  return request({
    url: "/custom/info/applyBecome/" + id,
    method: "get",
  });
}

// 新增客户信息
export function addInfo(data) {
  return request({
    url: "/custom/info",
    method: "post",
    data: data,
  });
}

// 修改客户信息
export function updateInfo(data) {
  return request({
    url: "/custom/info",
    method: "put",
    data: data,
  });
}

// 修改合同客户信息
export function updateContractCustom(data) {
  return request({
    url: "/contract/contractCustomInfo",
    method: "put",
    data: data,
  });
}

// 删除客户信息
export function delInfo(id) {
  return request({
    url: "/custom/info/" + id,
    method: "delete",
  });
}

//图片预览  上传
export function loadImage(id, type) {
  return request({
    url: "/custom/info/loadImage/" + id + "/" + type,
    responseType: "blob",
    method: "get",
  });
}
// 上传图片 新接口
export function uploadContractImage(data) {
  return request({
    url: "/custom/info/uploadContractImage/",
    responseType: "blob",
    method: "post",
    data: data,
  });
}
// 删除图片
export function deleteContractImage(data) {
  return request({
    url: "/custom/info/deleteContractImage",
    method: "post",
    params: data,
  });
}
// 预览新接口
export function loadContractImage(fileName) {
  return request({
    url: `/custom/info/loadContractImage/${fileName}/`,
    responseType: "blob",
    method: "get",
  });
}
// 业务描述查看图片
export function previewImage(data) {
  return request({
    url: "/custom/info/loadImageOfAddress",
    method: "post",
    data: data,
    responseType: "blob",
  });
}
// 获取介绍人
export function findCustom(name) {
  return request({
    url: "/custom/info/findCustom",
    method: "get",
    params: {
      name: name,
    },
  });
}

export function applyToPublic(ids) {
  return request({
    url: "/custom/info/applyToPublic/" + ids,
    method: "get",
  });
}
export function applyAddPublicApprove(ids, status) {
  return request({
    url: "/custom/info/applyAddPublicApprove/" + ids + "/" + status,
    method: "get",
  });
}

//查看pdf

export function openPDF(filename) {
  return request({
    url: "/contract/task/pdf/" + filename,
    method: "get",
    responseType: "blob",
  });
}

// 查询客户档案
export function contractCustomList(query) {
  return request({
    url: "/custom/info/contractCustomList",
    method: "get",
    params: query,
  });
}
// 财务管理，分配任务
export function contractTaskUser(data) {
  return request({
    url: "/contract/task/user/add",
    method: "post",
    data: data,
  });
}
